package com.hessian;

import com.caucho.hessian.client.HessianProxyFactory;
import com.hessian.domain.MyCar;

import java.net.MalformedURLException;
import java.util.Map;
import java.util.Set;

/**
 * Created by buguniao on 15/12/10.
 */
public class HessianClientTest {
    public static void main(String[] args) {
        String url = "http://localhost:8088/hessian";
        HessianProxyFactory factory = new HessianProxyFactory();
        try {
            HelloHessian hello = (HelloHessian) factory.create(HelloHessian.class, url);
            System.out.println(hello.sayHello());

            MyCar car = hello.getMyCar();
            System.out.println(car.toString());

            Map<String,String> map = hello.myBabays();
            for(String key:map.keySet()){
                System.out.println(key+" - "+map.get(key));
            }

            for (Object str : hello.myLoveFruit()) {
                System.out.println(str);
            }

        } catch (MalformedURLException e) {
            e.printStackTrace();
        }

    }
}
